# 客户端
from socket import *
import json


client = socket(AF_INET, SOCK_STREAM)
# client.connect(('127.0.0.1', 8000))
client.connect(('127.0.0.1', 8888))


while True:
    msg = input('>>: ').strip()
    if not msg:
        continue

    if msg in ['break', 'exit']:
        break

    client.send(msg.encode('utf-8'))

    data_0 = client.recv(1024)
    data_1 = data_0.decode('utf-8')
    print(data_1)

client.close()
